package com.boot.security.server.common;

import java.io.Serializable;
import java.util.List;

/**
 *
 * @param <T>
 * @param <B>
 */
public class PaginationResultSummary<T,B> extends  PaginationResult<T> implements Serializable {
    private static final long serialVersionUID = 1L;
    private B summary;

    public B getSummary() {
        return summary;
    }

    public void setSummary(B summary) {
        this.summary = summary;
    }

    public static <T,B> PaginationResultSummary<T,B> success(List<T> data, int total,B summary) {
        PaginationResultSummary<T,B> paginationResult = new PaginationResultSummary<>();
        paginationResult.setCode(ErrorCode.OK.getCode());
        paginationResult.setMessage(ErrorCode.OK.getMessage());
        paginationResult.setData(data);
        paginationResult.setTotal(total);
        paginationResult.setSummary(summary);
        return paginationResult;
    }
}
